<template>
  <div class="goodsDesc">
    <van-nav-bar title="传智播客-黑马程序员" left-text="返回" left-arrow @click-left="$router.back()" />
    <h2>{{info.title}}</h2>
    <div v-html="info.content" class="content"></div>
  </div>
</template>
<script>
import { getdesc } from "@/apis/goods.js";
export default {
  data() {
    return {
      info: [],
    };
  },
  async mounted() {
    let res = await getdesc(this.$route.params.id);
    console.log(res);
    this.info = res.data.message[0];
  },

  updated() {
    setTimeout(() => {
      let imgs1 = document.querySelectorAll("p img");

      for (let i = 0; i < imgs1.length; i++) {
        imgs1[i].setAttribute("width", "100%");
        imgs1[i].removeAttribute("height");
      }
    }, 10);
  },
};
</script>
<style lang="less" scoped>
.goodsDesc {
  margin: 60px 0 50px;
  h2 {
    font-size: 20px;
    font-weight: 600;
    padding: 10px;
    color: cornflowerblue;
    border-bottom: 1px solid #ccc;
    margin-bottom: 12px;
  }
  .content {
    /deep/ p {
      color: rgb(110, 109, 109);
      margin: 10px 0;
      font-size: 18px;
    }
  }
}
</style>